Optimal. Leaf size=128 \[ \frac {3 \left (2 a^2-b^2\right ) x}{2 b^4}-\frac {6 a \sqrt {a^2-b^2} \tan ^{-1}\left (\frac {b+a \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a^2-b^2}}\right )}{b^4 d}+\frac {3 \cos (c+d x) (2 a-b \sin (c+d x))}{2 b^3 d}-\frac {\cos ^3(c+d x)}{b d (a+b \sin (c+d x))} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.14, antiderivative size = 128, normalized size of antiderivative = 1.00, number of steps
used = 6, number of rules used = 6, integrand size = 21, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.286, Rules used = {2772, 2944,
2814, 2739, 632, 210} \begin {gather*} -\frac {6 a \sqrt {a^2-b^2} \text {ArcTan}\left (\frac {a \tan \left (\frac {1}{2} (c+d x)\right )+b}{\sqrt {a^2-b^2}}\right )}{b^4 d}+\frac {3 x \left (2 a^2-b^2\right )}{2 b^4}+\frac {3 \cos (c+d x) (2 a-b \sin (c+d x))}{2 b^3 d}-\frac {\cos ^3(c+d x)}{b d (a+b \sin (c+d x))} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 210
Rule 632
Rule 2739
Rule 2772
Rule 2814
Rule 2944
Rubi steps
\begin {align*} \int \frac {\cos ^4(c+d x)}{(a+b \sin (c+d x))^2} \, dx &=-\frac {\cos ^3(c+d x)}{b d (a+b \sin (c+d x))}-\frac {3 \int \frac {\cos ^2(c+d x) \sin (c+d x)}{a+b \sin (c+d x)} \, dx}{b}\\ &=\frac {3 \cos (c+d x) (2 a-b \sin (c+d x))}{2 b^3 d}-\frac {\cos ^3(c+d x)}{b d (a+b \sin (c+d x))}-\frac {3 \int \frac {-a b-\left (2 a^2-b^2\right ) \sin (c+d x)}{a+b \sin (c+d x)} \, dx}{2 b^3}\\ &=\frac {3 \left (2 a^2-b^2\right ) x}{2 b^4}+\frac {3 \cos (c+d x) (2 a-b \sin (c+d x))}{2 b^3 d}-\frac {\cos ^3(c+d x)}{b d (a+b \sin (c+d x))}-\frac {\left (3 a \left (a^2-b^2\right )\right ) \int \frac {1}{a+b \sin (c+d x)} \, dx}{b^4}\\ &=\frac {3 \left (2 a^2-b^2\right ) x}{2 b^4}+\frac {3 \cos (c+d x) (2 a-b \sin (c+d x))}{2 b^3 d}-\frac {\cos ^3(c+d x)}{b d (a+b \sin (c+d x))}-\frac {\left (6 a \left (a^2-b^2\right )\right ) \text {Subst}\left (\int \frac {1}{a+2 b x+a x^2} \, dx,x,\tan \left (\frac {1}{2} (c+d x)\right )\right )}{b^4 d}\\ &=\frac {3 \left (2 a^2-b^2\right ) x}{2 b^4}+\frac {3 \cos (c+d x) (2 a-b \sin (c+d x))}{2 b^3 d}-\frac {\cos ^3(c+d x)}{b d (a+b \sin (c+d x))}+\frac {\left (12 a \left (a^2-b^2\right )\right ) \text {Subst}\left (\int \frac {1}{-4 \left (a^2-b^2\right )-x^2} \, dx,x,2 b+2 a \tan \left (\frac {1}{2} (c+d x)\right )\right )}{b^4 d}\\ &=\frac {3 \left (2 a^2-b^2\right ) x}{2 b^4}-\frac {6 a \sqrt {a^2-b^2} \tan ^{-1}\left (\frac {b+a \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a^2-b^2}}\right )}{b^4 d}+\frac {3 \cos (c+d x) (2 a-b \sin (c+d x))}{2 b^3 d}-\frac {\cos ^3(c+d x)}{b d (a+b \sin (c+d x))}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] Leaf count is larger than twice the leaf count of optimal. \(448\) vs. \(2(128)=256\).
time = 5.02, size = 448, normalized size = 3.50 \begin {gather*} \frac {\cos ^3(c+d x) \left (-12 a (a-b) \tanh ^{-1}\left (\frac {\sqrt {a-b} \sqrt {-\frac {b (1+\sin (c+d x))}{a-b}}}{\sqrt {a+b} \sqrt {-\frac {b (-1+\sin (c+d x))}{a+b}}}\right ) \sqrt {1-\sin (c+d x)} (a+b \sin (c+d x))+\sqrt {a+b} \left (12 a \sqrt {a-b} \tanh ^{-1}\left (\frac {\sqrt {\frac {b (1+\sin (c+d x))}{-a+b}}}{\sqrt {-\frac {b (-1+\sin (c+d x))}{a+b}}}\right ) \sqrt {1-\sin (c+d x)} (a+b \sin (c+d x))+\sqrt {-\frac {b (-1+\sin (c+d x))}{a+b}} \left (6 \sqrt {b} (-2 a+b) \sinh ^{-1}\left (\frac {\sqrt {a-b} \sqrt {-\frac {b (1+\sin (c+d x))}{a-b}}}{\sqrt {2} \sqrt {b}}\right ) (a+b \sin (c+d x))+\sqrt {a-b} \sqrt {1-\sin (c+d x)} \sqrt {\frac {b (1+\sin (c+d x))}{-a+b}} \left (-6 a^2+2 b^2-3 a b \sin (c+d x)+b^2 \sin ^2(c+d x)\right )\right )\right )\right )}{2 (a-b)^{3/2} b^2 \sqrt {a+b} d (1-\sin (c+d x))^{3/2} \sqrt {-\frac {b (-1+\sin (c+d x))}{a+b}} \left (-\frac {b (1+\sin (c+d x))}{a-b}\right )^{3/2} (a+b \sin (c+d x))} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.66, size = 220, normalized size = 1.72
method | result | size |
derivativedivides | \(\frac {\frac {\frac {2 \left (\frac {b^{2} \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2}+2 a b \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-\frac {b^{2} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{2}+2 a b \right )}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{2}}+3 \left (2 a^{2}-b^{2}\right ) \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{b^{4}}-\frac {2 \left (\frac {-\frac {\left (a^{2}-b^{2}\right ) b^{2} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{a}-b \left (a^{2}-b^{2}\right )}{a \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+2 b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+a}+3 a \sqrt {a^{2}-b^{2}}\, \arctan \left (\frac {2 a \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+2 b}{2 \sqrt {a^{2}-b^{2}}}\right )\right )}{b^{4}}}{d}\) | \(220\) |
default | \(\frac {\frac {\frac {2 \left (\frac {b^{2} \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2}+2 a b \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-\frac {b^{2} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{2}+2 a b \right )}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{2}}+3 \left (2 a^{2}-b^{2}\right ) \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{b^{4}}-\frac {2 \left (\frac {-\frac {\left (a^{2}-b^{2}\right ) b^{2} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{a}-b \left (a^{2}-b^{2}\right )}{a \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+2 b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+a}+3 a \sqrt {a^{2}-b^{2}}\, \arctan \left (\frac {2 a \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+2 b}{2 \sqrt {a^{2}-b^{2}}}\right )\right )}{b^{4}}}{d}\) | \(220\) |
risch | \(\frac {3 x \,a^{2}}{b^{4}}-\frac {3 x}{2 b^{2}}+\frac {i {\mathrm e}^{2 i \left (d x +c \right )}}{8 b^{2} d}+\frac {a \,{\mathrm e}^{i \left (d x +c \right )}}{b^{3} d}+\frac {a \,{\mathrm e}^{-i \left (d x +c \right )}}{b^{3} d}-\frac {i {\mathrm e}^{-2 i \left (d x +c \right )}}{8 b^{2} d}-\frac {2 i \left (a^{2}-b^{2}\right ) \left (i b +a \,{\mathrm e}^{i \left (d x +c \right )}\right )}{b^{4} d \left (-i b \,{\mathrm e}^{2 i \left (d x +c \right )}+i b +2 a \,{\mathrm e}^{i \left (d x +c \right )}\right )}+\frac {3 \sqrt {-a^{2}+b^{2}}\, a \ln \left ({\mathrm e}^{i \left (d x +c \right )}-\frac {-i a +\sqrt {-a^{2}+b^{2}}}{b}\right )}{d \,b^{4}}-\frac {3 \sqrt {-a^{2}+b^{2}}\, a \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a +\sqrt {-a^{2}+b^{2}}}{b}\right )}{d \,b^{4}}\) | \(256\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: ValueError} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.40, size = 411, normalized size = 3.21 \begin {gather*} \left [\frac {b^{3} \cos \left (d x + c\right )^{3} + 3 \, {\left (2 \, a^{3} - a b^{2}\right )} d x + 3 \, {\left (a b \sin \left (d x + c\right ) + a^{2}\right )} \sqrt {-a^{2} + b^{2}} \log \left (\frac {{\left (2 \, a^{2} - b^{2}\right )} \cos \left (d x + c\right )^{2} - 2 \, a b \sin \left (d x + c\right ) - a^{2} - b^{2} + 2 \, {\left (a \cos \left (d x + c\right ) \sin \left (d x + c\right ) + b \cos \left (d x + c\right )\right )} \sqrt {-a^{2} + b^{2}}}{b^{2} \cos \left (d x + c\right )^{2} - 2 \, a b \sin \left (d x + c\right ) - a^{2} - b^{2}}\right ) + 3 \, {\left (2 \, a^{2} b - b^{3}\right )} \cos \left (d x + c\right ) + 3 \, {\left (a b^{2} \cos \left (d x + c\right ) + {\left (2 \, a^{2} b - b^{3}\right )} d x\right )} \sin \left (d x + c\right )}{2 \, {\left (b^{5} d \sin \left (d x + c\right ) + a b^{4} d\right )}}, \frac {b^{3} \cos \left (d x + c\right )^{3} + 3 \, {\left (2 \, a^{3} - a b^{2}\right )} d x + 6 \, {\left (a b \sin \left (d x + c\right ) + a^{2}\right )} \sqrt {a^{2} - b^{2}} \arctan \left (-\frac {a \sin \left (d x + c\right ) + b}{\sqrt {a^{2} - b^{2}} \cos \left (d x + c\right )}\right ) + 3 \, {\left (2 \, a^{2} b - b^{3}\right )} \cos \left (d x + c\right ) + 3 \, {\left (a b^{2} \cos \left (d x + c\right ) + {\left (2 \, a^{2} b - b^{3}\right )} d x\right )} \sin \left (d x + c\right )}{2 \, {\left (b^{5} d \sin \left (d x + c\right ) + a b^{4} d\right )}}\right ] \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F(-1)] Timed out
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Timed out} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 5.58, size = 235, normalized size = 1.84 \begin {gather*} \frac {\frac {3 \, {\left (2 \, a^{2} - b^{2}\right )} {\left (d x + c\right )}}{b^{4}} - \frac {12 \, {\left (a^{3} - a b^{2}\right )} {\left (\pi \left \lfloor \frac {d x + c}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (a\right ) + \arctan \left (\frac {a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + b}{\sqrt {a^{2} - b^{2}}}\right )\right )}}{\sqrt {a^{2} - b^{2}} b^{4}} + \frac {2 \, {\left (b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 4 \, a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 4 \, a\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 1\right )}^{2} b^{3}} + \frac {4 \, {\left (a^{2} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + a^{3} - a b^{2}\right )}}{{\left (a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 2 \, b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + a\right )} a b^{3}}}{2 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 6.40, size = 601, normalized size = 4.70 \begin {gather*} \frac {\frac {2\,\left (3\,a^2-b^2\right )}{b^3}+\frac {6\,a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4}{b^3}+\frac {6\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2\,\left (2\,a^2-b^2\right )}{b^3}+\frac {\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (9\,a^2-2\,b^2\right )}{a\,b^2}+\frac {4\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3\,\left (3\,a^2-b^2\right )}{a\,b^2}+\frac {{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^5\,\left (3\,a^2-2\,b^2\right )}{a\,b^2}}{d\,\left (a\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^6+2\,b\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^5+3\,a\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4+4\,b\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3+3\,a\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+2\,b\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )+a\right )}+\frac {6\,a\,\mathrm {atanh}\left (\frac {432\,a^3\,\sqrt {b^2-a^2}}{432\,a^3\,b-\frac {432\,a^5}{b}-864\,a^4\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )+864\,a^2\,b^2\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}+\frac {864\,a^2\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {b^2-a^2}}{432\,a^3-\frac {432\,a^5}{b^2}+864\,a^2\,b\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )-\frac {864\,a^4\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{b}}+\frac {432\,a^4\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\sqrt {b^2-a^2}}{432\,a^5+864\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a^4\,b-432\,a^3\,b^2-864\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a^2\,b^3}\right )\,\sqrt {b^2-a^2}}{b^4\,d}-\frac {\mathrm {atan}\left (\frac {432\,a^5\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{432\,a^5-648\,a^3\,b^2+216\,a\,b^4}-\frac {648\,a^3\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{216\,a\,b^2-648\,a^3+\frac {432\,a^5}{b^2}}+\frac {216\,a\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{216\,a-\frac {648\,a^3}{b^2}+\frac {432\,a^5}{b^4}}\right )\,\left (a^2\,2{}\mathrm {i}-b^2\,1{}\mathrm {i}\right )\,3{}\mathrm {i}}{b^4\,d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________